package lc.字符串;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/14
 */
public class 剑指Offer05_替换空格 {

    public String replaceSpace(String s) {

        char[] chars = s.toCharArray();
        StringBuilder str = new StringBuilder();
        for (char aChar : chars) {

            if (aChar == ' ')
                str.append("%20");
            else {
                str.append(aChar);
            }

        }
        return str.toString();
    }

}
